home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Hello / Sources / Select.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.1 KB  |  160 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Select.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Hello.hpp"
  11.  
  12. #ifndef SELECT_H
  13. #include "Select.h"
  14. #endif
  15.  
  16. #ifndef CONTENT_H
  17. #include "Content.h"
  18. #endif
  19.  
  20. #ifndef PART_H
  21. #include "Part.h"
  22. #endif
  23.  
  24. #ifndef DEFINES_K
  25. #include "Defines.k"
  26. #endif
  27.  
  28. // ----- Framework Includes -----
  29.  
  30. #ifndef FWPRESEN_H
  31. #include "FWPresen.h"
  32. #endif
  33.  
  34. #ifndef FWUTIL_H
  35. #include "FWUtil.h"
  36. #endif
  37.  
  38. // ----- OS Includes -----
  39.  
  40. #ifndef FWBARRAY_H
  41. #include "FWBArray.h"
  42. #endif
  43.  
  44. // ----- Foundation Layer -----
  45.  
  46. #ifndef FWSUSINK_H
  47. #include "FWSUSink.h"
  48. #endif
  49.  
  50. #ifndef FWSTREAM_H
  51. #include "FWStream.h"
  52. #endif
  53.  
  54. #ifndef FWSTRING_H
  55. #include "FWString.h"
  56. #endif
  57.  
  58. // ----- OpenDoc Includes -----
  59.  
  60. #ifndef SOM_Module_OpenDoc_StdProps_defined
  61. #include <StdProps.xh>
  62. #endif
  63.  
  64. // ----- Macintosh Includes -----
  65.  
  66. #if defined(FW_BUILD_MAC) && !defined(__DRAG__)
  67. #include <Drag.h>
  68. #endif
  69.  
  70. //========================================================================================
  71. //    Runtime information
  72. //========================================================================================
  73.  
  74. #ifdef FW_BUILD_MAC
  75. #pragma segment odfhello
  76. #endif
  77.  
  78. FW_DEFINE_AUTO(CHelloSelection)
  79.  
  80. //========================================================================================
  81. //    Constants
  82. //========================================================================================
  83.  
  84. const ODPropertyName kHelloPropText = "Hello:Property:Text";
  85.  
  86. //========================================================================================
  87. //    CLASS CHelloSelection
  88. //========================================================================================
  89.  
  90. //---------------------------------------------------------------------------------------
  91. //    CHelloSelection constructor
  92. //---------------------------------------------------------------------------------------
  93.  
  94. CHelloSelection::CHelloSelection(Environment* ev, CHelloContent* content) :
  95.     FW_CSelection(ev, false, false),
  96.     fHelloContent(content)
  97. {
  98. }
  99.  
  100. //---------------------------------------------------------------------------------------
  101. //    CHelloSelection destructor
  102. //---------------------------------------------------------------------------------------
  103.  
  104. CHelloSelection::~CHelloSelection()
  105. {
  106. }
  107.  
  108. //---------------------------------------------------------------------------------------
  109. //    CHelloSelection::GetSelectedContent
  110. //---------------------------------------------------------------------------------------
  111. //    The whole content is always selected
  112.  
  113. FW_CContent* CHelloSelection::GetSelectedContent(Environment* ev)
  114. {
  115. FW_UNUSED(ev);
  116.     return fHelloContent;
  117. }
  118.  
  119. //---------------------------------------------------------------------------------------
  120. //    CHelloSelection::ClearSelection
  121. //---------------------------------------------------------------------------------------
  122.  
  123. void CHelloSelection::ClearSelection(Environment* ev)
  124. {
  125.     fHelloContent->ClearTextData(ev); 
  126. }
  127.  
  128. //---------------------------------------------------------------------------------------
  129. //    CHelloSelection::CloseSelection
  130. //---------------------------------------------------------------------------------------
  131.  
  132. void CHelloSelection::CloseSelection(Environment* ev)
  133. {
  134. FW_UNUSED(ev);
  135.     // Nothing to do
  136. }
  137.  
  138. //---------------------------------------------------------------------------------------
  139. //    CHelloSelection::IsEmpty
  140. //---------------------------------------------------------------------------------------
  141.  
  142. FW_Boolean CHelloSelection::IsEmpty(Environment* ev) const
  143. {
  144. FW_UNUSED(ev);
  145.     // Is the current string empty?
  146.     return (fHelloContent->GetTextData().GetByteLength() == 0);
  147. }
  148.  
  149. //---------------------------------------------------------------------------------------
  150. //    CHelloSelection::SelectAll
  151. //---------------------------------------------------------------------------------------
  152.  
  153. void CHelloSelection::SelectAll(Environment* ev)
  154. {
  155. FW_UNUSED(ev);
  156.     // Part's data is always "selected"
  157. }
  158.  
  159.  
  160.